Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix alarm time span match in silence and notice #1318

Merged
merged 2 commits into from
Nov 6, 2023
Merged

Conversation

tomsun28
Copy link
Contributor

@tomsun28 tomsun28 commented Nov 6, 2023

What's changed?

bugfix alarm time span match in silence and notice

Checklist

  • I hereby agree to the terms of the HertzBeat CLA
  • I have read the Contributing Guide
  • I have written the necessary doc or comment.
  • I have added the necessary unit tests and all cases have passed.

@tomsun28 tomsun28 requested a review from Ceilzcx November 6, 2023 14:45
@tomsun28 tomsun28 added enhancement New feature or request bugfix labels Nov 6, 2023
@tomsun28 tomsun28 added this to the v1.4.2 milestone Nov 6, 2023
@tomsun28 tomsun28 requested a review from zqr10159 November 6, 2023 14:46
boolean endMatch = alertSilence.getPeriodEnd() == null ||
nowDate.isBefore(alertSilence.getPeriodEnd().toLocalDateTime());
if (startMatch && endMatch) {
int times = alertSilence.getTimes() == null ? 0 : alertSilence.getTimes();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

int times = Optional.ofNullable(alertSilence.getTimes()).orElse(0);

nowTime.isAfter(alertSilence.getPeriodStart().toLocalTime());
boolean endMatch = alertSilence.getPeriodEnd() == null ||
nowTime.isBefore(alertSilence.getPeriodEnd().toLocalTime());
if (startMatch && endMatch) {
int times = alertSilence.getTimes() == null ? 0 : alertSilence.getTimes();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

int times = Optional.ofNullable(alertSilence.getTimes()).orElse(0);

Copy link
Member

@zqr10159 zqr10159 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这两个地方可不可以用Optional

@tomsun28
Copy link
Contributor Author

tomsun28 commented Nov 6, 2023

这两个地方可不可以用Optional

收到 已更新

@hertzbeat
Copy link
Contributor

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Can Optional be used in these two places?

Received Updated

Copy link
Member

@zqr10159 zqr10159 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍👍👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants